package com.css.zfzx.fxpg.modules.attach;

import com.css.bpm.platform.api.local.PlatformAPI;
import com.css.bpm.platform.api.local.org.DeptAPI;
import com.css.bpm.platform.components.attach.repository.entity.SysAttachmentEntity;
import com.css.bpm.platform.org.dept.repository.entity.DeptEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 附件上传测试
 *
 * @author leon
 * @date 2020/11/23 11:15
 */
@RestController
@RequestMapping("/a")
public class AttachmentController {
    @Autowired
    FxAttachmentRepository sysAttachment;

    @GetMapping("/a")
    public void getInfo() {
        DeptAPI deptAPI = PlatformAPI.getOrgAPI().getDeptAPI();

        DeptEntity root = deptAPI.getDeptByDeptCode("DZJ");
        List<DeptEntity> depts = deptAPI.getSubDepts(root.getDeptId());

        System.out.println(root);
        depts.stream().forEach(deptEntity -> {
            System.out.println(deptEntity);
        });
        List<SysAttachmentEntity> l = sysAttachment.findByAttachNameAndIsValid("预评估数据结果模板.xlsx", "1");
        l.stream().forEach(a -> {
            System.out.println(a);
        });
    }
}
